/**
 * Данные, содержащие фотографию человека.
 */

#ifndef _PHOTO_H
#define	_PHOTO_H

#include <cstdlib>
#include <string>
#include "common/FileNotFoundException.h"

namespace etu {
namespace genealogy_tree {

using etu::common::FileNotFoundException;

class Photo {

    std::string hash;
    unsigned char* dataBuffer;
    int dataBufferLength;

public:
    Photo(const std::string& filePath) throw(FileNotFoundException);
    Photo(const std::string& hash, unsigned char* dataBuffer, int dataBufferLength);
    Photo(unsigned char* dataBuffer = NULL, int dataBufferLength = 0);
    Photo(const Photo& orig);
    virtual ~Photo();
    virtual std::string getHash() const;
    virtual unsigned char* getData() const;
    virtual int getDataLength() const;
    static Photo* empty();
    static bool isEmpty(const Photo& photo);
    
private:
    Photo();
    static unsigned char* copyBuffer(unsigned char* buffer, int length);
};

}
}

#endif	/* _PHOTO_H */

